package com.goodedeeds.domain.impl.db;

import com.youtills.core.db.DataSourceType;
import com.youtills.core.logging.Logger;
import com.youtills.core.mybatis.MybatisSqlSessionFactoryBuilder;
import org.apache.ibatis.session.SqlSessionFactory;

/**
 * Created by IntelliJ IDEA.
 * User: rchiluve
 * Date: 2/23/14
 * Time: 7:48 PM
 * To change this template use File | Settings | File Templates.
 */
class DomainDao {

    private static final Logger LOGGER = Logger.getLogger(DomainDao.class);

    private final SqlSessionFactory sqlSessionFactory;

    private DomainDao() {

        String resource = "com/goodedeeds/domain/impl/db/goodedeeds-domain-mybatis-config.xml";
        sqlSessionFactory = MybatisSqlSessionFactoryBuilder.buildSessionFactory(resource, DataSourceType.QGLDB);
    }

    private static final DomainDao instance = new DomainDao();

    protected static DomainDao getInstance(){
        return instance;
    }

    public SqlSessionFactory getSqlSessionFactory() {
        return sqlSessionFactory;
    }
}
